package com.fc.v2.util;

import cn.hutool.core.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.regex.Pattern;

@Component
public class UuidGenerator {
    private static final long START_NUM = 1000000000;

    /**
     * 生成uuid
     * @return
     */
    public String gen(){
       long s = START_NUM + RandomUtil.randomInt(9999);
        return String.valueOf(s);
    }

    public boolean verify(String userId){
//		userId合法性判断
        String patternStr = "1\\d{9}";
        boolean matches = Pattern.matches(patternStr, userId);
        return matches;
    }
}
